package com.geekstudy.week0.study4.controller;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.server.PathParam;
import java.util.LinkedHashMap;
import java.util.Map;

@RestController
public class HelloNameController {

    final Logger logger = LoggerFactory.getLogger(HelloNameController.class);

    @RequestMapping(path = "/hello/{path}")
    public Map<String, String> hello(@PathVariable(value = "path") String path, @RequestParam(name = "name") String name) {
        Map<String, String> resultMap = new LinkedHashMap<String, String>();
        logger.info("hello path:{} name:{} ", path, name);

        resultMap.put("message", "success");
        resultMap.put("path", path);
        resultMap.put("name", name);

        return resultMap;
    }
}
